<?php
include_once("connect.php");
include_once ("log_order.php"); //test!

$order_id=$_GET['id'];

$sql = "SELECT * FROM order_list WHERE id=$order_id";
$rs = mysql_query($sql);
if ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {	

	$shipper = $row['shipper'];
	$address_id1 = $row['address_from_id'];
	$address_id2 = $row['address_to_id'];

	$package_name=$row['package_name'];
	$package_weight=$row['package_weight'];
	$package_length=$row['package_length'];
	$package_width=$row['package_width'];
	$package_height=$row['package_height'];
	
	$item1_id = $row['item1_id'];
	$item2_id = $row['item2_id'];
	$item3_id = $row['item3_id'];
	
	$user_id = $row['order_user_id'];
	$update_time = $row['update_time'];
	
	//-----------------------------------------------
	$idc_name1 = '';	
	$country1 = '德国';
	$city1 = '';
	$address1 = '';
	$postcode1 = ''; 
	$tel1 = '';
	$email1 = '';
	$door_num1 = '';
	if($address_id1>0){	
		$sql = "SELECT * FROM order_address WHERE order_user_id=$user_id AND id=$address_id1";	
		$rs = mysql_query($sql);
		if ($row1 = mysql_fetch_array($rs, MYSQL_ASSOC)) {		
			$idc_name1 = $row1['idc_name'];
			$country1 = $row1['country'];
			$city1 = $row1['city'];
			$address1 = $row1['address'];
			$postcode1 = $row1['postcode'];
			$tel1 = $row1['tel'];
			$email1 = $row1['email'];
			$door_num1 = $row1['door_num'];		
		} 
	}

	$idc_name2 = '';	
	$country2 = '中国大陆';
	$province2 = '';
	$city2 = '';
	$address2 = '';
	$postcode2 = ''; 
	$tel2 = '';
	$email2 = '';
	if($address_id2>0){	
		$sql = "SELECT * FROM order_address WHERE order_user_id=$user_id AND id=$address_id2";	
		$rs = mysql_query($sql);
		if ($row2 = mysql_fetch_array($rs, MYSQL_ASSOC)) {		
			$idc_name2 = $row2['idc_name'];
			$country2 = $row2['country'];
			$province2 = $row2['province'];
			$city2 = $row2['city'];
			$address2 = $row2['address'];
			$postcode2 = $row2['postcode'];
			$tel2 = $row2['tel'];
			$email2 = $row2['email'];				
		} 	
	}	
		
	
	//-----------------------------------------------
	$item_name1 = '';
	$item_madein1 = '';
	$item_amount1 = '';
	$item_pre_weight1 = '';
	$item_pre_price1 = '';
	$item_weight1 = '';
	$item_price1 = '';	
	if($item1_id>0){
		$sql = "SELECT * FROM order_item WHERE id=$item1_id";	
		$rs = mysql_query($sql);
		if ($row1 = mysql_fetch_array($rs, MYSQL_ASSOC)) {			
			$item_name1 = $row1['item_name'];
			$item_madein1 = $row1['item_madein'];
			$item_amount1 = $row1['item_amount'];
			$item_pre_weight1 = $row1['item_pre_weight'];
			$item_pre_price1 = $row1['item_pre_price'];
			$item_weight1 = $row1['item_weight'];
			$item_price1 = $row1['item_price'];			
		} 	
	}

	$item_name2 = '';
	$item_madein2 = '';
	$item_amount2 = '';
	$item_pre_weight2 = '';
	$item_pre_price2 = '';
	$item_weight2 = '';
	$item_price2 = '';	
	if($item2_id>0){
		$sql = "SELECT * FROM order_item WHERE id=$item2_id";	
		$rs = mysql_query($sql);
		if ($row2 = mysql_fetch_array($rs, MYSQL_ASSOC)) {			
			$item_name2 = $row2['item_name'];
			$item_madein2 = $row2['item_madein'];
			$item_amount2 = $row2['item_amount'];
			$item_pre_weight2 = $row2['item_pre_weight'];
			$item_pre_price2 = $row2['item_pre_price'];
			$item_weight2 = $row2['item_weight'];
			$item_price2 = $row2['item_price'];			
		} 	
	}
	
	$item_name3 = '';
	$item_madein3 = '';
	$item_amount3 = '';
	$item_pre_weight3 = '';
	$item_pre_price3 = '';
	$item_weight3 = '';
	$item_price3 = '';	
	if($item3_id>0){
		$sql = "SELECT * FROM order_item WHERE id=$item3_id";	
		$rs = mysql_query($sql);
		if ($row3 = mysql_fetch_array($rs, MYSQL_ASSOC)) {			
			$item_name3 = $row3['item_name'];
			$item_madein3 = $row3['item_madein'];
			$item_amount3 = $row3['item_amount'];
			$item_pre_weight3 = $row3['item_pre_weight'];
			$item_pre_price3 = $row3['item_pre_price'];
			$item_weight3 = $row3['item_weight'];
			$item_price3 = $row3['item_price'];			
		} 	
	}

} 

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="hello" />
<meta name="description" content="Hello" />
<title>order_item</title>

<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/fancybox.css" />

<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-cn.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="js/jquery.fancybox.js" type="text/javascript"></script>
<script src="js/jquery.message.js" type="text/javascript"></script>

<style type="text/css">
table{width:100%; margin:20px auto; border-collapse:collapse;}
table td{line-height:24px; padding:2px; padding-left:8px; border:1px solid #b6d6e6;}
.table_title{height:26px; line-height:26px; background:url(css/btn_bg.gif) repeat-x bottom; font-weight:bold; text-indent:.3em; outline:0;}
.table_label2{background:#e8f5fe; text-align:center; font-weight:bold;}
.table_label{background:#e8f5fe; text-align:right; }

.table_line{ text-align:center; font-weight:bold;}

.btn{height:24px; background:url(css/btn_bg.gif) repeat-x; padding:0 4px; font-size:12px; border:1px solid #ccc; cursor:pointer; margin-left:3px}
.input{border:1px solid #369; background:#ffc; padding:2px}
.msg{padding-left:30px; margin-top:20px}
textarea{font-size:12px}
</style>

<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript">
$(function(){
	$("#cancle_btn").click(function(){
		//window.history.back(-1); 
		self.location='order_list.php';
	});

});
</script>
</head>

<body>

<div id="main">

  
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <thead>
    <tr class="table_title">
      <td colspan="6"><?php 
		echo "订单详细-订单号:".$order_id; 
	  ?></td>
    </tr>
  </thead>
  <tbody>
	<!-- ------------------------------------------------ -->	
  
	<tr>
      <td class="table_label2"  colspan="2" width="30%">&nbsp;寄件人信息</td>
	  <td class="table_label2"  colspan="2" width="30%">&nbsp;收件人信息</td>	  
	  <td class="table_line"  colspan="2" width="30%">录入时间：<?php echo $update_time; ?></td>  
    </tr>
	
    <tr>
      <td class="table_label" width="12%">寄件人：</td>
      <td class="edit" width="20%" ><?php echo $idc_name1; ?>
	  </td>	  
	  <td class="table_label" width="12%">收件人：</td>
      <td class="edit" width="20%" ><?php echo $idc_name2; ?>
	  </td>
	  
	  <td class="table_label" width="12%">物流商：</td>
      <td class="edit"  width="20%"><?php echo $shipper; ?>
	  </td>	 
    </tr>
	
	<tr>
      <td class="table_label" >*国家/地区：</td>
      <td class="edit" ><?php echo $country1; ?>
		</td>	  
	  <td class="table_label" >*国家/地区：</td>
      <td class="edit" ><?php echo $country2; ?>
	  </td>
	  
	  <td class="table_line" colspan="2" > </td>
    </tr>	
	
	<tr>
      <td class="table_label" >*城市：</td>
      <td class="edit" ><?php echo $city1; ?>
	  </td>	  
	  <td class="table_label" >*省份：</td>
      <td class="edit" ><?php echo $province2; ?>
	  </td>	  
	  
	  <td class="table_label2" colspan="2" >包裹信息 </td>
    </tr>
	
	<tr>
      <td class="table_label" >*门牌号：</td>
      <td class="edit" ><?php echo $door_num1; ?>
	  </td>	  
	  <td class="table_label" >*城市：</td>
      <td class="edit"  ><?php echo $city2; ?>
	  </td>	
	  
	  <td class="table_label" >包裹总重(公斤)：</td>
      <td class="edit" ><?php echo $package_weight; ?>
	  </td>
    </tr>
	
	<tr>
      <td class="table_label" >*地址：</td>
      <td class="edit" ><?php echo $address1; ?>
	  </td>	  
	  <td class="table_label" >*地址：</td>
      <td class="edit" ><?php echo $address2; ?>
	  </td>	
	  
	  <td class="table_label" >包裹长(厘米)：</td>
      <td class="edit" ><?php echo $package_length; ?>
	  </td>	  
    </tr>
	
	<tr>
      <td class="table_label" >*邮编：</td>
      <td class="edit" ><?php echo $postcode1; ?>
	  </td>	  
	  <td class="table_label" >*邮编：</td>
      <td class="edit" ><?php echo $postcode2; ?>
	  </td>
	  
	  <td class="table_label" >包裹宽(厘米)：</td>
      <td class="edit" ><?php echo $package_width; ?>
	  </td>	  
    </tr>

	<tr>
      <td class="table_label" >*联系电话：</td>
      <td class="edit" ><?php echo $tel1; ?>
	  </td>	  
	  <td class="table_label" >*联系电话：</td>
      <td class="edit" ><?php echo $tel2; ?>
	  </td>	
	  
	  <td class="table_label" >包裹高(厘米)：</td>
      <td class="edit" ><?php echo $package_height; ?>
	  </td>	  
    </tr>

	<tr>
      <td class="table_label" >*联系email：</td>
      <td class="edit" ><?php echo $email1; ?>
	  </td>	  
	  <td class="table_label" >*联系email：</td>
      <td class="edit" ><?php echo $email2; ?>
	  </td>
	  
	  <td class="table_label" >物品名称：</td>
      <td class="edit" ><?php echo $package_name; ?>
	  </td>	  
    </tr>
 
	<!-- ------------------------------------------------ -->		

	
	<!-- ------------------------------------------------ -->	
	<tr>
      <td class="table_line" id="shipper" colspan="6" alight=center>&nbsp</td>
    </tr>  
	<tr>
      <td class="table_label2"  colspan="2" width="30%">物品1信息(必填)</td>
	  <td class="table_label2"  colspan="2" width="30%">物品2信息(选填)</td>
	  <td class="table_label2"  colspan="2" width="30%">物品3信息(选填)</td>
    </tr>	
	<tr>
      <td class="table_label" >物品1名称：</td>
      <td class="edit"  ><?php echo $item_name1; ?>
	  </td>	  
	  <td class="table_label" >物品2名称：</td>
      <td class="edit"  ><?php echo $item_name2; ?>
	  </td>
	  <td class="table_label" >物品3名称：</td>
      <td class="edit"  ><?php echo $item_name3; ?>
	  </td>
    </tr>
	
	<tr>
      <td class="table_label">物品1数量：</td>
      <td class="edit" ><?php echo $item_amount1; ?>
	  </td>	  
	  <td class="table_label">物品2数量：</td>
      <td class="edit" ><?php echo $item_amount2; ?>
	  </td>	
	  <td class="table_label">物品3数量：</td>
      <td class="edit" ><?php echo $item_amount3; ?>
	  </td>	
    </tr>		
	
	<tr>
      <td class="table_label">单位净重(公斤)：</td>
      <td class="edit" ><?php echo $item_pre_weight1; ?>
	  </td>	  
	  <td class="table_label">单位净重(公斤)：</td>
      <td class="edit" ><?php echo $item_pre_weight2; ?>
	  </td>	
	  <td class="table_label">单位净重(公斤)：</td>
	  </td>	
    </tr>		

	<tr>
      <td class="table_label">物品1原产地：</td>
      <td class="edit" ><?php echo $item_madein1; ?>
	  </td>	  
	  <td class="table_label">物品2原产地：</td>
      <td class="edit" ><?php echo $item_madein2; ?>
	  </td>	
	  <td class="table_label">物品3原产地：</td>
      <td class="edit" ><?php echo $item_madein3; ?>
	  </td>	
    </tr>		
	
	<tr>
      <td class="table_label">物品1单价(欧元)：</td>
      <td class="edit" ><?php echo $item_pre_price1; ?>
	  </td>	  
	  <td class="table_label">物品2单价(欧元)：</td>
      <td class="edit" ><?php echo $item_pre_price2; ?>
	  </td>	
	  <td class="table_label">物品3单价(欧元)：</td>
      <td class="edit" ><?php echo $item_pre_price3; ?>
	  </td>	
    </tr>

	<tr>
      <td class="table_label">物品1总价(欧元)：</td>
      <td class="edit" ><?php echo $item_price1; ?>
	  </td>	  
	  <td class="table_label">物品2总价(欧元)：</td>
      <td class="edit" ><?php echo $item_price2; ?>
	  </td>	
	  <td class="table_label">物品3总价(欧元)：</td>
      <td class="edit" ><?php echo $item_price3; ?>
	  </td>	
    </tr>

	<tr>
      <td class="table_label">物品1总重(公斤)：</td>
      <td class="edit" ><?php echo $item_weight1; ?>
	  </td>	  
	  <td class="table_label">物品2总重(公斤)：</td>
      <td class="edit" ><?php echo $item_weight2; ?>
	  </td>	
	  <td class="table_label">物品3总重(公斤)：</td>
      <td class="edit" ><?php echo $item_weight2; ?>
	  </td>	
    </tr>		
	<!-- ------------------------------------------------ -->
	<tr>
      <td class="table_line"  colspan="6" alight=center>
	  
	  <input type="button" class="btn" id="cancle_btn" value="返 回" />
	  </td>
    </tr> 
	
  </tbody>
</table>

<br />

</div>

</body>
</body>
</html>